package com.gitee.ywj1352.nettyserver.core;

import com.gitee.ywj1352.nettyserver.handler.ServerProcessHandler;
import com.gitee.ywj1352.nettyserver.serialize.ProtobufDecoder;
import com.gitee.ywj1352.nettyserver.serialize.ProtobufEncoder;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.util.concurrent.UnorderedThreadPoolEventExecutor;

public class CoreChannelInitializer extends ChannelInitializer<NioSocketChannel> {

//    private UnorderedThreadPoolEventExecutor executors;
//
//
//    public CoreChannelInitializer(UnorderedThreadPoolEventExecutor unorderedThreadPoolEventExecutor) {
//        this.executors = unorderedThreadPoolEventExecutor;
//    }


    

    @Override
    protected void initChannel(NioSocketChannel nioSocketChannel) throws Exception {

        ChannelPipeline pipeline = nioSocketChannel.pipeline();

        pipeline.addLast(new ProtobufDecoder());
        pipeline.addLast(new ProtobufEncoder());

        pipeline.addLast(new ServerProcessHandler());

    }
}
